<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form lay-filter="systemNoteInfoForm" class="layui-form model-form" id="systemNoteInfoForm">
                <input id="id" name="id" type="hidden"/>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否SSL加密</label>
                    <div class="layui-input-block">
                        <input type="radio" name="isSsl" value="0" title="否"/>
                        <input type="radio" name="isSsl" value="1" title="是" checked/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">应用id</label>
                    <div class="layui-input-block">
                        <input name="applyId" placeholder="请输入应用id" type="text" class="layui-input"
                               lay-verify="required" required/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">密钥</label>
                    <div class="layui-input-block">
                        <input name="secretKey" placeholder="请输入密钥" type="text" class="layui-input"
                               lay-verify="required" required/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">签名</label>
                    <div class="layui-input-block">
                        <input name="sign" placeholder="请输入签名" type="text" class="layui-input" lay-verify="required"
                               required/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">测试号码</label>
                    <div class="layui-input-block">
                        <input name="testPhone" placeholder="请输入测试号码" type="text" class="layui-input"
                               lay-verify="required" required/>
                    </div>
                </div>
                <div class="layui-form-item text-right">
                    <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
                    <button class="layui-btn" lay-filter="systemNoteInfoFormSubmit" lay-submit>保存</button>
                </div>
            </form>
        </div>
    </div>
</div>
<style>
    #systemNoteInfoForm .layui-form-label{
        width: 85px;
        padding-left: 0;
    }
    #systemNoteInfoForm .layui-input-block{
        margin-left: 110px;
    }
</style>
<!-- js部分 -->
<script>
    layui.use(['layer', 'form', 'table', 'admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var admin = layui.admin;
        list();

        //初始化表单
        function list() {
            admin.req('enterprise/system/admin/systemNoteInfo/list', {}, function (res) {
                form.val("systemNoteInfoForm", res.data[0]);
                form.render();
            }, 'GET');
        }

        // 表单提交事件
        form.on('submit(systemNoteInfoFormSubmit)', function (d) {
            if ($("#id").val() != "") {
                admin.req('enterprise/system/admin/systemNoteInfo/update', d.field, function (res) {
                    layer.closeAll('loading');
                    if (res.code == 200) {
                        layer.msg(res.msg, {icon: 1});
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                    list();
                }, 'PUT');
            } else {
                admin.req('enterprise/system/admin/systemNoteInfo/add', d.field, function (res) {
                    layer.closeAll('loading');
                    if (res.code == 200) {
                        layer.msg(res.msg, {icon: 1});
                    } else {
                        layer.msg(res.msg, {icon: 2});
                    }
                    list();
                }, 'POST');
            }
            return false;
        });

    });
</script>